/*
 * @Author: doing
 * @Date: 2023-08-17 07:23:40
 * @LastEditors: git config user.name && git config user.email
 * @LastEditTime: 2023-08-26 20:56:26
 * @FilePath: \background-management-system\src\api\user.js
 * @Description: 
 * 用户接口
 * Copyright (c) 2023 by 1540265624@qq.com, All Rights Reserved. 
 */
import axios from '~/axios'
//获取用户总数
export function getUserTotal(){
    return axios.get('/system/user/total')
}
export function addUser(body){
    return axios.post('/system/user',body)
}
//更新用户
export function updataUser(body){
    return axios.put('/system/user',body)
}
//查找用户信息(不传递默认查找全部)
export function searchUser(body){
    return axios.post('/system/user/search',body)
}
//根据id删除用户信息
export function deleteUser(id){
    return axios.delete(`/system/user/${id}`)
}
//查找角色信息(不传递默认查找全部,不分页)
export function searchRole(body){
    return axios.post('/system/role/search',body)
}
//查询用户拥有角色的所有id
export function getUserRoleId(id){
    return axios.get(`/system/user/${id}/role/ids`)
}

//更新用户角色表
export function updataUserRole(uid,body){
    return axios.post(`/system/user/${uid}/role/save`,body)
}

//检验旧密码是否正确
export function validateOldPassword(body){
    return axios.post('/user/check/password',body)
}

//修改密码
export function updataPassword(uid,body){
    return axios.put('/system/user/password')
}

//上传图片接口
export function uploadPic(body){
    return axios.post('/content/file/upload',body)
}

//删除图片接口
export function deletePic(fileUrl){
    return axios.delete('/content/file/delete',{
        params:{
            fileUrl
        }
    })
}


